home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / Sync.man < prev    next >
Encoding:
Text File  |  1989-04-10  |  3.4 KB  |  135 lines

  1.  
  2.  
  3.  
  4. Sync                  C Library Procedures                   Sync
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      Sync - Synchronization overview
  12.  
  13. SSYYNNOOPPSSIISS
  14.      This section provides an overview of the Sprite SSyynncc__ system
  15.      routines.
  16.  
  17. _________________________________________________________________
  18.  
  19. DDEESSCCRRIIPPTTIIOONN
  20.      Sprite provides system calls to allow processes to synchron-
  21.      ize execution using Mesa-style monitors.
  22.  
  23.      The following set of macros are used  to  emulate  monitored
  24.      procedures  of  Mesa.   The  LLOOCCKK__MMOONNIITTOORR and UUNNLLOOCCKK__MMOONNIITTOORR
  25.      macros depend on a  constant  LLOOCCKKPPTTRR.   LLOOCCKKPPTTRR  should  be
  26.      defined as the address of the lock variable used to lock the
  27.      monitor. Something like the  following  two  lines  of  code
  28.      should  appear  at the beginning of a file of monitored pro-
  29.      cedures.
  30.  
  31.          #include <sync.h>
  32.  
  33.          Sync_Lock modMonitorLock;
  34.          #define LOCKPTR (&modMonitorLock)
  35.  
  36.      The pseudo-keywords IINNTTEERRNNAALL and EENNTTRRYY denote  internal  and
  37.      entry procedures of a monitor.  IINNTTEERRNNAALL procedures can only
  38.      be called when the monitor lock is held.   EENNTTRRYY  procedures
  39.      are  procedures  that  acquire  the lock.  There may also be
  40.      External procedures.  They are the default and there  is  no
  41.      special  keyword.   An External procedure doesn't explicitly
  42.      acquire the monitor lock, but may call an EENNTTRRYY procedure.
  43.  
  44.  
  45.      Condition variables represent  events  that  are  associated
  46.      with  locks.   The  operations  on  a condition variable are
  47.      SSyynncc__WWaaiitt and SSyynncc__BBrrooaaddccaasstt. SSyynncc__WWaaiitt allows a process  to
  48.      wait   for   a   particular   monitor  condition  to  occur.
  49.      SSyynncc__BBrrooaaddccaasstt wakes up all processes waiting on a  particu-
  50.      lar  condition.  The  lock must be acquired before a call to
  51.      these routines is made.  The lock is released while  a  pro-
  52.      cess  waits on a condition, and is then re-acquired when the
  53.      condition is notified via SSyynncc__BBrrooaaddccaasstt.
  54.  
  55.      SSyynncc__BBrrooaaddccaasstt is the only mechanism for  awakening  waiting
  56.      processes.   For example, there is no means to notify only a
  57.      single process awaiting a particular condition.  If  several
  58.      processes  are  awaiting the availability of a single shared
  59.      resource, all processes awaiting the condition must be noti-
  60.      fied;  they  must  each  recheck for the availability of the
  61.      resource, and all but one will find the resource unavailable
  62.  
  63.  
  64.  
  65. Sprite v.1.0        Printed:  April 10, 1989                    1
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. Sync                  C Library Procedures                   Sync
  73.  
  74.  
  75.  
  76.      and wait again.
  77.  
  78.      SSyynncc__WWaaiittTTiimmee is used to cause the process to  sleep  for  a
  79.      specific  amount  of time. The process will be woken up if a
  80.      signal arrives.
  81.  
  82. SSEEEE AALLSSOO
  83.      Sync_Broadcast, Sync_Wait, Sync_WaitTime
  84.  
  85. KKEEYYWWOORRDDSS
  86.      synchronization, wait, block, process, event, wakeup, broad-
  87.      cast
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. Sprite v.1.0        Printed:  April 10, 1989                    2
  132.  
  133.  
  134.  
  135.